package com.kaibes.web.admin;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.ui.Model;

@Component
public class AdminControllerUtils {

    @Autowired
    private AdminMenuConfig adminMenuConfig;
    
    public void setMenu(Model model, String uri) {
        if (model.getAttribute("currentMenu") == null) {
            model.addAttribute("currentMenu", AdminMenuUtils.findByHref(adminMenuConfig.getAdminMenus(), uri));
        }
    }
    
}
